package component
{
	import spark.components.Label;
	
	public class LegendLabel extends Label
	{
		private var _legendColor:int = 0xFF0000;
		private var _selected:Boolean = false;
		public function set legendColor(value:int):void
		{
			_legendColor = value;
		}
		
		public function set Selected(value:Boolean):void
		{
			_selected = value;
			this.invalidateDisplayList();
		}
		
		public function LegendLabel()
		{
			super();
		}
		
		override protected function commitProperties():void
		{
			super.commitProperties();
			this.height = 20;
			this.setStyle("paddingLeft",33);
			this.setStyle("paddingTop",2);
			this.setStyle("fontWeight","bold");
		}
		
		override  protected function updateDisplayList (w:Number,h:Number) : void
		{
			super.updateDisplayList(w ,h);
			graphics.clear() ;
			graphics.beginFill(_legendColor);
			graphics.drawRoundRect(0,0,30,14,1);
			graphics.endFill();
			
			if(_selected)
			{
				graphics.lineStyle(2,0xEE4000);
				graphics.drawRect(0,0,30,14);
			}
		}
	}
}